package ru.beta2.testyard.engine;

import ru.beta2.testyard.ExpectMessageScript;
import ru.beta2.testyard.Script;
import ru.beta2.testyard.SkipControl;

/**
 * User: Inc
 * Date: 23.06.2008
 * Time: 2:02:48
 * todo tests
 */
public class PinnedScript implements Script
{

    private final Script pinned;

    public PinnedScript(Script scriptToPin)
    {
        this.pinned = scriptToPin;
    }

    public Script login(int player)
    {
        pinned.login(player);
        return this;
    }

    public Script logout(int player)
    {
        pinned.logout(player);
        return this;
    }

    public Script expectJoinChannel(int player, String channel)
    {
        pinned.expectJoinChannel(player, channel);
        return this;
    }

    public Script expectLeaveChannel(int player, String channel)
    {
        pinned.expectLeaveChannel(player, channel);
        return this;
    }

    public <T> ExpectMessageScript<T> expectSessionMessage(int player, T message)
    {
        pinned.expectSessionMessage(player, message);
        return new ExpectMessagePinnedScript(pinned);
    }

    public <T> ExpectMessageScript<T> expectChannelMessage(int player, String channel, T message)
    {
        pinned.expectChannelMessage(player, channel, message);
        return new ExpectMessagePinnedScript(pinned);
    }

    public <T> ExpectMessageScript<T> expectChannelMessage(String channel, T message)
    {
        pinned.expectChannelMessage(channel, message);
        return new ExpectMessagePinnedScript(pinned);
    }

    public Script sendSessionMessage(int player, Object message)
    {
        pinned.sendSessionMessage(player, message);
        return this;
    }

    public Script sendChannelMessage(int player, String channel, Object message)
    {
        pinned.sendChannelMessage(player, channel, message);
        return this;
    }

    public SkipControl skipSessionMessages(Class messageClass)
    {
        return pinned.skipSessionMessages(messageClass);
    }

    public SkipControl skipChannelMessages(String channel, Class messageClass)
    {
        return pinned.skipChannelMessages(channel, messageClass);
    }

    public SkipControl skipJoinChannels()
    {
        return pinned.skipJoinChannels();
    }

    public SkipControl skipLeaveChannels()
    {
        return pinned.skipLeaveChannels();
    }

    public Script pin()
    {
        return this;
    }

    public Script unpin()
    {
        return pinned;
    }

}
